package com.application.race.manage.player;

import java.util.List;

import com.application.item.pojo.Car;
import com.application.item.pojo.Part;

public class CarInfo {
   public double maxUpSpeed=0;
   public double maxDownSpeed=0;
   public double  sideClipCft=0;
   public double confRadius=0;
   public double weight=0;
   public double accCft=0;
   public double braCft=0;
   public double turnCft=0;
   public double slipResistance=0;
   public int endure=0;
   
   public int minatk=0;
   public int maxatk=0;
   public int mindef=0;
   public int maxdef=0;
   public int fatalatkchance=0; // 0-100
   public int unfatalatkchance=0; // 0-100
   public int dodgechance=0;//0-100; 
   public int undodgechance=0;//0-100; 
   public int tenacity=0;//0-100
   public int damage=0;
   public int resceistan=0;
   public int undoDefence=0;
   public int caroticchance=0;//0-100; 
   public int uncaroticchance=0;//0-100; 
   
	 
	int tmaxUpSpeed=0;
	int taccCft=0;
 
	int tsideClipCft=0;
	int tturnCft=0;
	 
   public CarInfo(Car car,List<Part>parts){
	   
	   this.confRadius=car.confradius;
	 
 
	   addPartProp(car);
        for(int i=0;i<parts.size();i++){
        	addPartProp(parts.get(i));
        }		
		
		this.maxUpSpeed=tmaxUpSpeed/1000.0;

		this.maxDownSpeed=maxUpSpeed*0.6;
		this.accCft=taccCft/100000.0;
		this.braCft=accCft;
		this.sideClipCft=tsideClipCft/100.0;
		this.turnCft=tturnCft/100.0;
		cacuSR();
   }
   public void addPartProp(Car part){
	    tmaxUpSpeed+=part.speed;
	    taccCft+=part.acccft;
	    tsideClipCft+=part.sccft;
	    tturnCft+=part.turncft; 
	   
		endure+=part.endure;
		weight+=part.weight;
		
		minatk+=part.minatk;
		maxatk+=part.maxatk;
		mindef+=part.mindef;
		maxdef+=part.maxdef;
		
		fatalatkchance+=part.fatalatkchance; 
		unfatalatkchance+=part.unfatalatkchance;
		dodgechance+=part.dodgechance;
		undodgechance+=part.undodgechance;
		caroticchance+=part.caroticchance;
		uncaroticchance+=part.uncaroticchance;	
   }
   public void cacuSR(){
	   slipResistance=(0.9+this.weight/20000)*this.sideClipCft;
   }

}
